// SFDL3Dlg.h : header file
//
//{{AFX_INCLUDES()
#include "agentctlex.h"
#include "agentctlcharacterex.h"
#include "agentctlcharacters.h"
#include "agentctlcommandsex.h"
#include "agentctlcommand.h"
#include "agentctlrequest.h"
#include "agentctluserinput.h"
//}}AFX_INCLUDES

#if !defined(AFX_SFDL3DLG_H__91E09139_27B5_4DF3_B845_C279CD44F96B__INCLUDED_)
#define AFX_SFDL3DLG_H__91E09139_27B5_4DF3_B845_C279CD44F96B__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/////////////////////////////////////////////////////////////////////////////
// CSFDL3Dlg dialog

#include "Configuration.h"

#include "INotifier.h"

#include <afxtempl.h>


class CSFDL3Dlg;
typedef void (CSFDL3Dlg::*pCmdHandler)();
typedef struct{CString Name; pCmdHandler Handler;} CmdHandlerEntry;


class CSFDL3Dlg : public CDialog
{
// Construction
public:
	virtual  ~CSFDL3Dlg();
	CSFDL3Dlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CSFDL3Dlg)
	enum { IDD = IDD_SFDL3_DIALOG };
	CAgentCtlEx	m_AgentCtl;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSFDL3Dlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CSFDL3Dlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnCommandMsagent(LPDISPATCH UserInput);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnHideMsagent(LPCTSTR CharacterID, short Cause);
	DECLARE_EVENTSINK_MAP()
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

// Command Handlers
protected:
	void OnAgentConfig();
	void OnAgentGreeting();
	void OnAgentQuit();
	void OnAgentStatistics();

	void AddCommand(CString csName, pCmdHandler pHdler);

	void SwitchToActive();
	void SwitchToDeactive();

	void GetActiveTimeInfo(CTimeSpan& spanSection, CTimeSpan& spanTotal);

	void NotifyForWorkTimeSpan();


	inline void Speak(const CString&);

public:

protected:
	CConfiguration* m_pConfig;
	CNotifyManager	m_NotifyManager;

	bool m_bUserActive;
	CTime m_LastActiveTime;
	CTime m_LastSwitchTime;
	CTime m_StartTime;

	CTimeSpan m_CompletedSectionTime;

	CAgentCtlCharacterEx m_Character;

	bool m_bExit;
	
	CList<CmdHandlerEntry, const CmdHandlerEntry&> m_Hanlders;

	static CString CONFIG_FILE;
	static CString CHAR_ID;
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SFDL3DLG_H__91E09139_27B5_4DF3_B845_C279CD44F96B__INCLUDED_)
